# coding = utf-8
# 登录界面
import sys
import pictures
from PyQt5.QtWidgets import QLineEdit
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap, QPainter, QColor

window = QtWidgets.QApplication(sys.argv)  # 实例化应用对象
main_windows = QtWidgets.QMainWindow()
main_windows.setFixedSize(794, 608)
userName = ""  # 用户名
password = ""  # 密码
password_1 = ""
password_2 = ""
flag_exit = 0
flag_user_account_victory_build = 0  # 成功建立新的账户
flag_victory_log_in = 0  # 成功登入系统标志
flag_forget_load = 0
path_user_information = "./txt_sources/UsersInformation.txt"  # 存储用户信息的txt文件路径


# 登录界面的主界面，基类族
# 警告弹窗，基类
class BeginMainWindowWarningPopup(object):
    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(293, 116)
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(190, 80, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(40, 30, 191, 20))
        self.label.setObjectName("label")
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Warning"))
        self.pushButton.setText(_translate("Dialog", "确定"))
        self.label.setText(_translate("Dialog", "输入的用户或者密码不存在！"))


# 输入正确提示的弹窗，基类
class BeginMainWindowTruePopup(object):
    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(293, 116)
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(190, 80, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(40, 30, 220, 20))
        self.label.setObjectName("label")
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Tips"))
        self.pushButton.setText(_translate("Dialog", "确定"))
        self.label.setText(_translate("Dialog", "输入正确，点击确定继续下一步"))


# 主界面，基类
class BeginMainWindow(object):
    def __init__(self):
        self.flag = 0
        self.userName = ""
        self.password = ""

    def get_pix_map(self, path, opacity):
        pix_map = QPixmap(path)
        size = QPixmap(pix_map.size())
        size.fill(Qt.transparent)
        temp = QPainter(size)
        temp.setCompositionMode(QPainter.CompositionMode_Source)
        temp.drawPixmap(0, 0, pix_map)
        temp.setCompositionMode(QPainter.CompositionMode_DestinationIn)
        temp.fillRect(size.rect(), QColor(0, 0, 0, opacity))
        temp.end()
        return pix_map

    # 初始化界面
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.setWindowModality(Qt.ApplicationModal)
        MainWindow.setFixedSize(794, 590)
        font = QtGui.QFont()
        font.setFamily("华文楷体")
        MainWindow.setFont(font)
        MainWindow.setMouseTracking(True)
        MainWindow.setTabletTracking(False)
        MainWindow.setFocusPolicy(Qt.ClickFocus)
        MainWindow.setAcceptDrops(False)
        MainWindow.setLayoutDirection(Qt.LeftToRight)
        MainWindow.setAutoFillBackground(False)
        MainWindow.setStyleSheet("")
        MainWindow.setDocumentMode(False)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setStyleSheet("border-image url(:/background/background_1.ico)")
        self.centralwidget.setObjectName("centralwidget")
        self.pushButton_5 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_5.setGeometry(QtCore.QRect(670, 20, 93, 28))
        self.pushButton_5.setObjectName("pushButton_5")
        self.pushButton_6 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_6.setGeometry(QtCore.QRect(670, 60, 93, 28))
        self.pushButton_6.setObjectName("pushButton_6")
        self.pushButton_7 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_7.setGeometry(QtCore.QRect(670, 140, 93, 28))
        self.pushButton_7.setObjectName("pushButton_7")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(240, 270, 72, 16))
        self.label.setTextFormat(Qt.AutoText)
        self.label.setScaledContents(True)
        self.label.setWordWrap(True)
        self.label.setOpenExternalLinks(True)
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(240, 310, 30, 17))
        self.label_2.setObjectName("label_2")
        self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_2.setGeometry(QtCore.QRect(320, 310, 201, 21))
        self.lineEdit_2.setFocusPolicy(Qt.WheelFocus)
        self.lineEdit_2.setContextMenuPolicy(Qt.ActionsContextMenu)
        self.lineEdit_2.setEchoMode(QLineEdit.Password)
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(310, 370, 93, 28))
        palette = QtGui.QPalette()
        self.pushButton.setPalette(palette)
        self.pushButton.setStyleSheet("color rgba(255, 255, 255, 10);")
        self.pushButton.setAutoExclusive(False)
        self.pushButton.setObjectName("pushButton")
        self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_2.setGeometry(QtCore.QRect(430, 370, 93, 28))
        self.pushButton_2.setObjectName("pushButton_2")
        self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_3.setGeometry(QtCore.QRect(310, 410, 93, 28))
        self.pushButton_3.setObjectName("pushButton_3")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(0, 0, 794, 608))
        self.label_3.setAutoFillBackground(False)
        self.label_3.setStyleSheet("border-image: url(:/background/background_2.jpg);")
        self.label_3.setText("")
        self.label_3.setObjectName("label_3")
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setGeometry(QtCore.QRect(320, 270, 201, 21))
        self.lineEdit.setObjectName("lineEdit")
        self.lineEdit.setPlaceholderText("User Name")
        self.lineEdit_2.setPlaceholderText("Password")
        self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
        self.checkBox.setGeometry(QtCore.QRect(200, 370, 91, 28))
        self.checkBox.setObjectName("checkBox")
        self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_4.setGeometry(QtCore.QRect(670, 100, 93, 28))
        self.pushButton_4.setObjectName("pushButton_4")
        self.label_3.raise_()
        self.pushButton_5.raise_()
        self.pushButton_6.raise_()
        self.pushButton_7.raise_()
        self.label.raise_()
        self.label_2.raise_()
        self.lineEdit_2.raise_()
        self.pushButton.raise_()
        self.pushButton_2.raise_()
        self.pushButton_3.raise_()
        self.lineEdit.raise_()
        self.checkBox.raise_()
        self.pushButton_4.raise_()
        self.pushButton.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.pushButton_2.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.pushButton_3.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.pushButton_4.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.pushButton_5.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.pushButton_6.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.pushButton_7.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.lineEdit.setStyleSheet("background-color: rgba(255, 255, 255, 180);")
        self.lineEdit_2.setStyleSheet("background-color: rgba(255, 255, 255, 180);")
        MainWindow.setCentralWidget(self.centralwidget)
        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        self.lineEdit.textEdited[str].connect(self.get_line_text)  # 获取文本框内容
        self.lineEdit_2.textEdited[str].connect(self.get_line_text)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.pushButton_5.setText(_translate("MainWindow", "关于"))
        self.pushButton_6.setText(_translate("MainWindow", "反馈"))
        self.pushButton_7.setText(_translate("MainWindow", "退出"))
        self.label.setText(_translate("MainWindow", "用户名"))
        self.label_2.setText(_translate("MainWindow", "密码"))
        self.pushButton.setText(_translate("MainWindow", "添加用户"))
        self.pushButton_2.setText(_translate("MainWindow", "忘记密码？"))
        self.pushButton_3.setText(_translate("MainWindow", "登录"))
        self.checkBox.setText(_translate("MainWindow", "记住用户"))
        self.pushButton_4.setText(_translate("MainWindow", "游客模式"))

    # 查找用户名
    def find_account(self):
        self.flag = 0
        global userName, password
        file = open("./txt_sources/AllUsers.txt", "r")
        for line in file.readlines():
            temp = line.split(" ")
            if userName == temp[0] and (password + "\n") == temp[1]:
                self.flag = 1
                break
        file.close()
        if self.flag:
            self.pushButton_3.clicked["bool"].connect(log_in_true.setup)  # 打开提示窗
            self.pushButton_3.clicked["bool"].connect(log_in_wrong.Dialog.close)  # 关闭异常提示窗
            # 按下弹窗按键，清空当前界面的所有窗口
            log_in_true.pushButton.clicked["bool"].connect(log_in_true.Dialog.close)
            log_in_true.pushButton.clicked["bool"].connect(main_windows.close)
            global flag_exit
            flag_exit = 1
        else:
            self.pushButton_3.clicked["bool"].connect(log_in_wrong.setup)  # 打开提示窗
            self.pushButton_3.clicked["bool"].connect(log_in_true.Dialog.close)  # 关闭异常展示的窗口
            log_in_wrong.pushButton.clicked["bool"].connect(log_in_wrong.Dialog.close)  # 手动关闭提示窗

    # 获取文本框内容
    def get_line_text(self):
        global userName, password
        userName = self.lineEdit.text()
        password = self.lineEdit_2.text()
        self.find_account()


# 登录界面的子界面(注册界面)
# 注册错误提示，基类
class SetUserAccountWarningPopup(object):
    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(400, 116)
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(280, 80, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(40, 30, 300, 20))
        self.label.setObjectName("label")
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Warning"))
        self.pushButton.setText(_translate("Dialog", "确定"))
        self.label.setText(_translate("Dialog", "出现错误，请仔细检查一遍!"))


# 注册正确提示，基类
class SetUserAccountTruePopup(object):
    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(400, 116)
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(280, 80, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.pushButton_2 = QtWidgets.QPushButton(Dialog)
        self.pushButton_2.setGeometry(QtCore.QRect(180, 80, 93, 28))
        self.pushButton_2.setObjectName("pushButton")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(40, 30, 300, 40))
        self.label.setObjectName("label")
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Lucky!"))
        self.pushButton.setText(_translate("Dialog", "确定"))
        self.pushButton_2.setText(_translate("Dialog", "取消"))
        self.label.setText(_translate("Dialog", "恭喜，已经创建了账号\n您可以选择是否设置密保问题"))


# 注册账号界面
class SetUserAccounts(object):
    def __init__(self):
        self.flag = 0

    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(600, 438)
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(50, 210, 71, 28))
        self.pushButton.setObjectName("pushButton")
        self.lineEdit = QtWidgets.QLineEdit(Dialog)
        self.lineEdit.setGeometry(QtCore.QRect(90, 120, 161, 21))
        self.lineEdit.setObjectName("lineEdit")
        self.lineEdit_2 = QtWidgets.QLineEdit(Dialog)
        self.lineEdit_2.setGeometry(QtCore.QRect(90, 150, 161, 21))
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.lineEdit_3 = QtWidgets.QLineEdit(Dialog)
        self.lineEdit_3.setGeometry(QtCore.QRect(90, 180, 161, 21))
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(20, 120, 72, 15))
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setGeometry(QtCore.QRect(20, 150, 72, 15))
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(Dialog)
        self.label_3.setGeometry(QtCore.QRect(20, 180, 72, 15))
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(Dialog)
        self.label_4.setGeometry(QtCore.QRect(0, 0, 600, 438))
        self.label_4.setAutoFillBackground(False)
        self.label_4.setStyleSheet("border-image: url(:/background/background_2.jpg);")
        self.label_4.setText("")
        self.label_4.setObjectName("label_4")
        self.pushButton_2 = QtWidgets.QPushButton(Dialog)
        self.pushButton_2.setGeometry(QtCore.QRect(145, 210, 71, 28))
        self.pushButton_2.setObjectName("pushButton_2")
        self.lineEdit.setPlaceholderText("user name")
        self.lineEdit_2.setPlaceholderText("Password")
        self.lineEdit_3.setPlaceholderText("Rewrite Password")
        self.label_4.raise_()
        self.pushButton.raise_()
        self.lineEdit.raise_()
        self.lineEdit_2.raise_()
        self.lineEdit_3.raise_()
        self.label.raise_()
        self.label_2.raise_()
        self.label_3.raise_()
        self.pushButton_2.raise_()
        self.retranslateUi(Dialog)
        self.pushButton.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.pushButton_2.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.lineEdit.setStyleSheet("background-color: rgba(255, 255, 255, 180);")
        self.lineEdit_2.setStyleSheet("background-color: rgba(255, 255, 255, 180);")
        self.lineEdit_3.setStyleSheet("background-color: rgba(255, 255, 255, 180);")
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        self.lineEdit.textEdited[str].connect(self.get_txt)  # 获得文本信息
        self.lineEdit_2.textEdited[str].connect(self.get_txt)
        self.lineEdit_3.textEdited[str].connect(self.get_txt)
        self.pushButton_2.clicked["bool"].connect(self.Dialog.close)  # 手动关闭窗口

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "注册用户"))
        self.pushButton.setText(_translate("Dialog", "确认"))
        self.label.setText(_translate("Dialog", "用户名"))
        self.label_2.setText(_translate("Dialog", "密码"))
        self.label_3.setText(_translate("Dialog", "确认密码"))
        self.pushButton_2.setText(_translate("Dialog", "取消"))

    def jude(self):
        self.flag = 0
        global userName, password1, password2
        if password1 == password2 and password1 and password2 and userName:
            self.flag = 1
        if self.flag:  # 出现符号条件的账号密码（密码一样即可）
            # 写入文件
            file = open("./txt_sources/AllUsers.txt", "a", encoding="utf-8")
            file.write(userName + " " + password1 + "\n")  # 写入密码以及账号
            file.close()
            # 取消报警提示窗口
            self.pushButton.clicked["bool"].connect(add_user_warning_popup.Dialog.close)  # 异常弹窗处理
            self.pushButton.clicked["bool"].connect(add_user_true_popup.setup)  # 调出“正确”的提示弹窗
            add_user_true_popup.pushButton_2.clicked["bool"].connect(add_user_true_popup.Dialog.close)  # 取消提示窗口
            add_user_true_popup.pushButton.clicked["bool"].connect(forget_password_second.setup)  # 调出密码窗口
            add_user_true_popup.pushButton.clicked["bool"].connect(add_user_true_popup.Dialog.close)  # 关闭提示窗口
        else:
            self.pushButton.clicked["bool"].connect(add_user_warning_popup.setup)  # 调出提示窗口
            self.pushButton.clicked["bool"].connect(add_user_true_popup.Dialog.close)  # 异常弹窗处理
            add_user_warning_popup.pushButton.clicked["bool"].connect(add_user_warning_popup.Dialog.close)  # 取消提示窗口

    def get_txt(self):
        global userName, password1, password2
        userName = self.lineEdit.text()
        password1 = self.lineEdit_2.text()
        password2 = self.lineEdit_3.text()
        self.jude()


# 登录界面的子界面（关于界面）
class About(object):
    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(400, 300)
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(290, 260, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.textBrowser = QtWidgets.QTextBrowser(Dialog)
        self.textBrowser.setGeometry(QtCore.QRect(0, 20, 391, 201))
        self.textBrowser.setObjectName("textBrowser")
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "关于"))
        self.pushButton.setText(_translate("Dialog", "确认"))
        self.textBrowser.setHtml(_translate("Dialog",
                                            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
                                            "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
                                            "p, li { white-space: pre-wrap; }\n"
                                            "</style></head><body style=\" font-family:\'SimSun\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
                                            "<p align=\"justify\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt;\">    本程序是一个我自己做的简陋版音乐播放器，可以播放OGG，mp3,flac等无特殊密钥的音乐的播放。本程序可以让你得到一个比较清爽的播放界面，虽然不可以移动其中的控件，但这问题不大。在这个播放器中，你可以播放系统自带的音乐，也可以播放自己下载的非VIP音乐（也就是非特殊编码的音频文件）。</span></p>\n"
                                            "<p align=\"justify\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt;\">    我叫谢玉培，是北京科技大学，计通学院，通信2101其中一名普通的学子。python程序设计课程结课了，我就想做这个程序，在做的过程中也遇到了很多困难，但我也学到了很多，了解了很多关于程序设计的知识。因为我是程序设计的一个小白，所以这次设计出的程序显得十分简陋（相比较于市面上的程序来说简陋无比），但也花费了我很多心思，从构思选题到程序实现都倾注了我很多的心血。之后，我有空也会对其进行一定的优化，如果您有更好的想法，或者发现了程序中的bug请联系我，联系方式如下，十分感谢您的联系。</span></p>\n"
                                            "<p align=\"justify\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt;\">    联系方式：246233707@qq.com。</span></p></body></html>"))


# 登录界面的子界面（反馈界面）
class FeedBack(object):
    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(400, 300)
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(280, 240, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.textBrowser = QtWidgets.QTextBrowser(Dialog)
        self.textBrowser.setGeometry(QtCore.QRect(60, 100, 291, 71))
        self.textBrowser.setObjectName("textBrowser")
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "感谢您的反馈"))
        self.pushButton.setText(_translate("Dialog", "确定"))
        self.textBrowser.setHtml(_translate("Dialog",
                                            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
                                            "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
                                            "p, li { white-space: pre-wrap; }\n"
                                            "</style></head><body style=\" font-family:\'SimSun\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
                                            "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt;\">    如果程序出现了bug，或者出现了错误，请联系我。</span></p>"
                                            "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt;\">    邮箱：246233707@qq.com。</span></p></body></html>"))


# 登录界面的子界面（忘记密码页面）
# 忘记密码的第一个界面
class FirstWindowNewPassword(object):
    def __init__(self):
        self.flag = 0

    def setupUi(self):
        global flag_forget
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        self.Dialog = Dialog
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(527, 336)
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(10, 120, 161, 16))
        self.label.setObjectName("label")
        self.lineEdit = QtWidgets.QLineEdit(Dialog)
        self.lineEdit.setGeometry(QtCore.QRect(170, 120, 200, 21))
        self.lineEdit.setObjectName("lineEdit")
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setGeometry(QtCore.QRect(0, 0, 527, 336))
        self.label_2.setStyleSheet("border-image: url(:/background/background_2.jpg);")
        self.label_2.setText("")
        self.label_2.setObjectName("label_2")
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(107, 150, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.pushButton_2 = QtWidgets.QPushButton(Dialog)
        self.pushButton_2.setGeometry(QtCore.QRect(217, 150, 93, 28))
        self.pushButton_2.setObjectName("pushButton_2")
        self.label_2.raise_()
        self.label.raise_()
        self.lineEdit.raise_()
        self.pushButton.raise_()
        self.pushButton_2.raise_()
        self.retranslateUi(Dialog)
        self.lineEdit.setPlaceholderText("just numbers and letters")
        self.pushButton.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.pushButton_2.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.lineEdit.setStyleSheet("background-color: rgba(255, 255, 255, 180);")
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        self.lineEdit.textEdited[str].connect(self.get_txt)
        self.pushButton_2.clicked["bool"].connect(self.Dialog.close)  # 手动关闭窗口

    def get_txt(self):
        self.flag = 0
        global userName
        userName = self.lineEdit.text()
        file = open("./txt_sources/AllUsers.txt", "r", encoding="utf-8")
        for line in file.readlines():
            temp = line.split(" ")
            if userName == temp[0]:
                self.flag = 1
        file.close()
        if self.flag:
            self.pushButton.clicked["bool"].connect(forget_password_second.setup)  # 打开第二个界面窗口
            self.pushButton.clicked["bool"].connect(add_user_warning_popup.Dialog.close)  # 关闭异常弹窗
            self.pushButton_2.clicked["bool"].connect(self.Dialog.close)  # 关闭自身窗口
        else:
            # 警告提示信息
            self.pushButton.clicked["bool"].connect(add_user_warning_popup.setup)  # 开弹窗
            add_user_warning_popup.pushButton.clicked["bool"].connect(add_user_warning_popup.Dialog.close)  # 关弹窗

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "输入待重置账户"))
        self.label.setText(_translate("Dialog", "需要重置密码的用户名"))
        self.pushButton.setText(_translate("Dialog", "确定"))
        self.pushButton_2.setText(_translate("Dialog", "取消"))


# 第二个界面的弹窗（“正确"）
class SecondWindowNewPasswordTruePopup(object):
    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(293, 116)
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(200, 80, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(40, 30, 200, 20))
        self.label.setObjectName("label")
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Lucky !"))
        self.pushButton.setText(_translate("Dialog", "确定"))
        self.label.setText(_translate("Dialog", "输入正确，点击确定重置密码"))


# 第二个界面的弹窗（”错误“）
class SecondWindowNewPasswordWarningPopup(object):
    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(293, 116)
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(190, 80, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(40, 30, 191, 20))
        self.label.setObjectName("label")
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Warning !"))
        self.pushButton.setText(_translate("Dialog", "确定"))
        self.label.setText(_translate("Dialog", "输入的答案出错了！"))


# 设置账户密保问题成功的时的弹窗提示
class SecondWindowNewPasswordSecretProblems(object):
    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(293, 116)
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(190, 80, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(40, 30, 191, 20))
        self.label.setObjectName("label")
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Lucky !"))
        self.pushButton.setText(_translate("Dialog", "确定"))
        self.label.setText(_translate("Dialog", "密保问题设置成功"))


# 忘记密码的第二个界面（用于注册）
class SecondWindowNewPassword(object):
    def __init__(self):
        self.flag = 0
        self.flag_forget = 0
        global flag_user_account_victory_build, flag_forget_load, userName
        flag_user_account_victory_build = self.flag
        flag_forget_load = self.flag_forget

    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        self.answer1 = ""
        self.answer2 = ""
        self.answer3 = ""
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(487, 366)
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(0, 0, 487, 366))
        self.label.setStyleSheet("border-image: url(:/background/background_3.jpg);")
        self.label.setText("")
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setGeometry(QtCore.QRect(100, 100, 261, 16))
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(Dialog)
        self.label_3.setGeometry(QtCore.QRect(20, 140, 171, 16))
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(Dialog)
        self.label_4.setGeometry(QtCore.QRect(20, 180, 171, 16))
        self.label_4.setObjectName("label_4")
        self.lineEdit = QtWidgets.QLineEdit(Dialog)
        self.lineEdit.setGeometry(QtCore.QRect(230, 140, 210, 21))
        self.lineEdit.setObjectName("lineEdit")
        self.lineEdit_2 = QtWidgets.QLineEdit(Dialog)
        self.lineEdit_2.setGeometry(QtCore.QRect(230, 180, 210, 21))
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.lineEdit_3 = QtWidgets.QLineEdit(Dialog)
        self.lineEdit_3.setGeometry(QtCore.QRect(230, 220, 210, 21))
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.label_5 = QtWidgets.QLabel(Dialog)
        self.label_5.setGeometry(QtCore.QRect(20, 220, 171, 20))
        self.label_5.setObjectName("label_5")
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(90, 260, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.pushButton_2 = QtWidgets.QPushButton(Dialog)
        self.pushButton_2.setGeometry(QtCore.QRect(250, 260, 93, 28))
        self.pushButton_2.setObjectName("pushButton_2")
        self.lineEdit.setPlaceholderText("just numbers and letters")
        self.lineEdit_2.setPlaceholderText("just numbers and letters")
        self.lineEdit_3.setPlaceholderText("just numbers and letters")
        self.retranslateUi(Dialog)
        self.lineEdit.setPlaceholderText("just numbers and letters")
        self.pushButton.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.pushButton_2.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.lineEdit.setStyleSheet("background-color: rgba(255, 255, 255, 180);")
        self.lineEdit_2.setStyleSheet("background-color: rgba(255, 255, 255, 180);")
        self.lineEdit_3.setStyleSheet("background-color: rgba(255, 255, 255, 180);")
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        self.lineEdit.textEdited[str].connect(self.get_txt)  # 获取文本数据
        self.lineEdit_2.textEdited[str].connect(self.get_txt)
        self.lineEdit_3.textEdited[str].connect(self.get_txt)
        self.pushButton_2.clicked["bool"].connect(self.Dialog.close)  # 手动关闭设置密保界面

    def write_txt(self):
        global answer_1, answer_2, answer_3
        if answer_1 and answer_2 and answer_3:
            self.flag = 1
        # 账密注册
        if self.flag:
            # 写入文件
            file = open("./txt_sources/UsersInformation.txt", "a")
            file.write(userName + " " + answer_1 + " " + answer_2 + " " + answer_3 + "\n")
            file.close()
            # 提示信息
            self.pushButton.clicked["bool"].connect(set_account_secret_problems.setup)  # 弹出设置成功的信息窗口
            self.pushButton.clicked["bool"].connect(self.Dialog.close)  # 关闭密保界面
            # 关闭账户设置界面
            set_account_secret_problems.pushButton.clicked["bool"].connect(add_users_main_window.Dialog.close)

    def get_txt(self):
        self.flag = 0
        global answer_1, answer_2, answer_3
        answer_1 = self.lineEdit.text()
        answer_2 = self.lineEdit_2.text()
        answer_3 = self.lineEdit_3.text()
        self.write_txt()

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "密保问题"))
        self.label_2.setText(_translate("Dialog", "请回答下列问题"))
        self.label_3.setText(_translate("Dialog", "您最喜欢的东西是什么？"))
        self.label_4.setText(_translate("Dialog", "您影响最深刻的人是谁？"))
        self.label_5.setText(_translate("Dialog", "您最难忘的事情是什么？"))
        self.pushButton.setText(_translate("Dialog", "确定"))
        self.pushButton_2.setText(_translate("Dialog", "取消"))


# 忘记密码的第二个界面（用于密码重置）
class SecondWindowNewPasswordNewClass(object):
    def __init__(self):
        self.flag_forget = 0

    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        self.answer1 = ""
        self.answer2 = ""
        self.answer3 = ""
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(487, 366)
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(0, 0, 487, 366))
        self.label.setStyleSheet("border-image: url(:/background/background_3.jpg);")
        self.label.setText("")
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setGeometry(QtCore.QRect(100, 100, 261, 16))
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(Dialog)
        self.label_3.setGeometry(QtCore.QRect(20, 140, 171, 16))
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(Dialog)
        self.label_4.setGeometry(QtCore.QRect(20, 180, 171, 16))
        self.label_4.setObjectName("label_4")
        self.lineEdit = QtWidgets.QLineEdit(Dialog)
        self.lineEdit.setGeometry(QtCore.QRect(230, 140, 210, 21))
        self.lineEdit.setObjectName("lineEdit")
        self.lineEdit_2 = QtWidgets.QLineEdit(Dialog)
        self.lineEdit_2.setGeometry(QtCore.QRect(230, 180, 210, 21))
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.lineEdit_3 = QtWidgets.QLineEdit(Dialog)
        self.lineEdit_3.setGeometry(QtCore.QRect(230, 220, 210, 21))
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.label_5 = QtWidgets.QLabel(Dialog)
        self.label_5.setGeometry(QtCore.QRect(20, 220, 171, 20))
        self.label_5.setObjectName("label_5")
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(90, 260, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.pushButton_2 = QtWidgets.QPushButton(Dialog)
        self.pushButton_2.setGeometry(QtCore.QRect(250, 260, 93, 28))
        self.pushButton_2.setObjectName("pushButton_2")
        self.lineEdit.setPlaceholderText("just numbers and letters")
        self.lineEdit_2.setPlaceholderText("just numbers and letters")
        self.lineEdit_3.setPlaceholderText("just numbers and letters")
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        self.lineEdit.setPlaceholderText("just numbers and letters")
        self.pushButton.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.pushButton_2.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.lineEdit.setStyleSheet("background-color: rgba(255, 255, 255, 180);")
        self.lineEdit_2.setStyleSheet("background-color: rgba(255, 255, 255, 180);")
        self.lineEdit_3.setStyleSheet("background-color: rgba(255, 255, 255, 180);")
        self.lineEdit.textEdited[str].connect(self.get_txt)  # 获取文本数据
        self.lineEdit_2.textEdited[str].connect(self.get_txt)
        self.lineEdit_3.textEdited[str].connect(self.get_txt)
        self.pushButton_2.clicked["bool"].connect(self.Dialog.close)  # 手动关闭设置密保界面

    def write_txt(self):
        global answer_1, answer_2, answer_3, userName
        # 检测用户的密保问题是否符合要求
        if answer_1 and answer_2 and answer_3:
            file = open("./txt_sources/UsersInformation.txt", "r")
            for line in file.readlines():
                temp = line.split(" ")
                if userName == temp[0] and temp[1] == answer_1 and temp[2] == answer_2 and temp[3] == (answer_3 + "\n"):
                    self.flag_forget = 1
            file.close()
        if self.flag_forget:
            self.pushButton.clicked["bool"].connect(forget_password_second_true_popup.setup)  # 弹出设置成功的信息窗口
            self.pushButton.clicked["bool"].connect(forget_password_second_warning_popup.Dialog.close)  # 关闭异常弹窗
            # 打开重置密码界面
            forget_password_second_true_popup.pushButton.clicked["bool"].connect(forget_password_third.setup)
            # 使用控件关闭已经弹出的界面
            forget_password_second_true_popup.pushButton.clicked["bool"].connect(self.Dialog.close)  # 自动关闭密保界面
            forget_password_second_true_popup.pushButton.clicked["bool"].connect(
                forget_password_second_true_popup.Dialog.close)  # 提示弹窗
        else:
            self.pushButton_2.clicked["bool"].connect(self.Dialog.close)  # 手动关闭密保界面
            self.pushButton.clicked["bool"].connect(forget_password_second_warning_popup.setup)  # 打开警告窗口
            forget_password_second_warning_popup.pushButton.clicked["bool"].connect(
                forget_password_second_warning_popup.Dialog.close)  # 手动关闭警告窗口

    def get_txt(self):
        self.flag_forget = 0
        global answer_1, answer_2, answer_3
        answer_1 = self.lineEdit.text()
        answer_2 = self.lineEdit_2.text()
        answer_3 = self.lineEdit_3.text()
        self.write_txt()

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "密保问题"))
        self.label_2.setText(_translate("Dialog", "请回答下列问题"))
        self.label_3.setText(_translate("Dialog", "您最喜欢的东西是什么？"))
        self.label_4.setText(_translate("Dialog", "您影响最深刻的人是谁？"))
        self.label_5.setText(_translate("Dialog", "您最难忘的事情是什么？"))
        self.pushButton.setText(_translate("Dialog", "确定"))
        self.pushButton_2.setText(_translate("Dialog", "取消"))


# 忘记密码的第三个界面
class ThirdWindowNewPassword(object):
    def __init__(self):
        self.flag = 0

    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        self.password_1 = ""  # 初次输入
        self.password_2 = ""  # 二次输入
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(500, 400)
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(0, 0, 500, 400))
        self.label.setStyleSheet("border-image: url(:/background/background_3.jpg);")
        self.label.setText("")
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setGeometry(QtCore.QRect(80, 150, 90, 21))
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(Dialog)
        self.label_3.setGeometry(QtCore.QRect(80, 190, 90, 21))
        self.label_3.setObjectName("label_3")
        self.lineEdit = QtWidgets.QLineEdit(Dialog)
        self.lineEdit.setGeometry(QtCore.QRect(210, 150, 210, 21))
        self.lineEdit.setObjectName("lineEdit")
        self.lineEdit_2 = QtWidgets.QLineEdit(Dialog)
        self.lineEdit_2.setGeometry(QtCore.QRect(210, 190, 210, 21))
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(110, 260, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.pushButton_2 = QtWidgets.QPushButton(Dialog)
        self.pushButton_2.setGeometry(QtCore.QRect(260, 260, 93, 28))
        self.pushButton_2.setObjectName("pushButton_2")
        self.lineEdit.setPlaceholderText("just numbers and letters")
        self.lineEdit_2.setPlaceholderText("just numbers and letters")
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        self.lineEdit.setPlaceholderText("just numbers and letters")
        self.pushButton.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.pushButton_2.setStyleSheet("background-color: rgba(255, 255, 255, 100);")
        self.lineEdit.setStyleSheet("background-color: rgba(255, 255, 255, 180);")
        self.lineEdit_2.setStyleSheet("background-color: rgba(255, 255, 255, 180);")
        self.lineEdit.textEdited[str].connect(self.get_txt)
        self.lineEdit_2.textEdited[str].connect(self.get_txt)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "设置密码"))
        self.label_2.setText(_translate("Dialog", "请输入密码"))
        self.label_3.setText(_translate("Dialog", "请确认密码"))
        self.pushButton.setText(_translate("Dialog", "确认"))
        self.pushButton_2.setText(_translate("Dialog", "取消"))

    def write_information(self):
        global userName, password_1, password_2
        if password_1 and password_2 and password_1 == password_2:
            self.flag = 1
        if self.flag:
            file = open("./txt_sources/AllUsers.txt", "a")
            file.write(userName + " " + password_2 + "\n")
            file.close()
            # 重设密码的弹窗
            self.pushButton.clicked["bool"].connect(forget_password_reset.setup)  # 点击确定，弹出提示窗
            self.pushButton.clicked["bool"].connect(add_user_warning_popup.Dialog.close)  # 去掉异常弹窗
            # 手动关闭密码重置窗口
            self.pushButton_2.clicked["bool"].connect(self.Dialog.close)
            # 点击确定，关闭提示窗口，以及不需要的窗口
            forget_password_reset.pushButton.clicked["bool"].connect(self.Dialog.close)
            # 关闭账户输入窗口
            forget_password_reset.pushButton.clicked["bool"].connect(forget_password_first_new.Dialog.close)
            # 最后关闭弹窗
            forget_password_reset.pushButton.clicked["bool"].connect(forget_password_reset.Dialog.close)
        else:
            # 弹出警告窗口
            self.pushButton.clicked["bool"].connect(add_user_warning_popup.setup)  # 调出提示窗口
            self.pushButton.clicked["bool"].connect(forget_password_reset.Dialog.close)  # 异常弹窗处理
            # 手动取消提示窗口
            add_user_warning_popup.pushButton.clicked["bool"].connect(add_user_warning_popup.Dialog.close)

    def get_txt(self):
        self.flag = 0
        global userName, password_1, password_2
        password_1 = self.lineEdit.text()
        password_2 = self.lineEdit_2.text()
        self.write_information()


# ”密码重置“界面提醒
class ForgetWindowResetPopup(object):
    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(400, 116)
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(280, 80, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(40, 30, 300, 20))
        self.label.setObjectName("label")
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Lucky"))
        self.pushButton.setText(_translate("Dialog", "确定"))
        self.label.setText(_translate("Dialog", "已经重置密码，请回到主窗口进行登录"))


# 几个分界面的类，子类族
# 主界面子类
class BeginMainWindowGenerate(QtWidgets.QMainWindow, BeginMainWindow):
    def __init__(self, parent=None):
        super(BeginMainWindowGenerate, self).__init__(parent)
        self.setupUi(main_windows)
        self.lineEdit.clear()
        self.lineEdit_2.clear()


# 登录界面的子界面（游客模式界面）
class VisitMode(object):
    def setupUi(self):
        Dialog = QtWidgets.QDialog()
        self.Dialog = Dialog
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(400, 116)
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(280, 80, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(20, 30, 400, 20))
        self.label.setObjectName("label")
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Sorry"))
        self.pushButton.setText(_translate("Dialog", "确定"))
        self.label.setText(_translate("Dialog", "抱歉，暂时不开放游客模式，点击确定回到主界面"))


# “关于”
class AboutWindow(QtWidgets.QDialog, About):
    def __init__(self, parent=None):
        super(AboutWindow, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# “反馈”
class FeedBackWindow(QtWidgets.QDialog, FeedBack):
    def __init__(self, parent: object = None):
        super(FeedBackWindow, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# “忘记密码”（第一个界面）
class FirstForgetPasswordWindow(QtWidgets.QDialog, FirstWindowNewPassword):
    def __init__(self, parent=None):
        super(FirstForgetPasswordWindow, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.lineEdit.clear()
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# 新建窗口类
class FirstForgetPasswordWindowNew(QtWidgets.QDialog, FirstWindowNewPassword):
    def __init__(self, parent=None):
        super(FirstForgetPasswordWindowNew, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.lineEdit.clear()
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()

    def get_txt(self):
        self.flag = 0
        global userName
        userName = self.lineEdit.text()
        file = open("./txt_sources/AllUsers.txt", "r")
        for line in file.readlines():
            temp = line.split(" ")
            if userName == temp[0]:
                self.flag = 1
        file.close()
        if self.flag:
            self.pushButton.clicked["bool"].connect(forget_password_second_new.setup)  # 打开第二个界面窗口
            self.pushButton.clicked["bool"].connect(add_user_warning_popup.Dialog.close)  # 关闭异常弹窗
            self.pushButton_2.clicked["bool"].connect(self.Dialog.close)  # 关闭自身窗口
        else:
            # 警告提示信息
            self.pushButton.clicked["bool"].connect(add_user_warning_popup.setup)  # 开弹窗
            add_user_warning_popup.pushButton.clicked["bool"].connect(add_user_warning_popup.Dialog.close)  # 关弹窗


# “忘记密码”（第二个界面）
class SecondForgetPasswordWindow(QtWidgets.QDialog, SecondWindowNewPassword):
    def __init__(self, parent=None):
        super(SecondForgetPasswordWindow, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.lineEdit.clear()
        self.lineEdit_2.clear()
        self.lineEdit_3.clear()
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# 新建忘记密码界面的第二个界面
class SecondForgetPasswordWindowNewClass(QtWidgets.QDialog, SecondWindowNewPasswordNewClass):
    def __init__(self, parent=None):
        super(SecondForgetPasswordWindowNewClass, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.lineEdit.clear()
        self.lineEdit_2.clear()
        self.lineEdit_3.clear()
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# 密保问题输入正确
class SecondForgetPasswordWindowTruePopup(QtWidgets.QDialog, SecondWindowNewPasswordTruePopup):
    def __init__(self, parent=None):
        super(SecondForgetPasswordWindowTruePopup, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# 密保问题输入错误
class SecondForgetPasswordWindowWarningPopup(QtWidgets.QDialog, SecondWindowNewPasswordWarningPopup):
    def __init__(self, parent=None):
        super(SecondForgetPasswordWindowWarningPopup, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# 账户设置的密保问题弹窗
class SecondForgetPasswordWindowSecretProblems(QtWidgets.QDialog, SecondWindowNewPasswordSecretProblems):
    def __init__(self, parent=None):
        super(SecondForgetPasswordWindowSecretProblems, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# “忘记密码”（第三个界面）
class ThirdForgetPasswordWindow(QtWidgets.QDialog, ThirdWindowNewPassword):
    def __init__(self, parent=None):
        super(ThirdForgetPasswordWindow, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.lineEdit.clear()
        self.lineEdit_2.clear()
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# 密码重置提示
class ForgetPasswordResetPopupWindow(QtWidgets.QDialog, ForgetWindowResetPopup):
    def __init__(self, parent=None):
        super(ForgetPasswordResetPopupWindow, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# 主界面登录的警告
class LogMainWindowWarningPopup(QtWidgets.QDialog, BeginMainWindowWarningPopup):
    def __init__(self, parent=None):
        super(LogMainWindowWarningPopup, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# 主界面登录的正确提示
class LogMainWindowTruePopup(QtWidgets.QDialog, BeginMainWindowTruePopup):
    def __init__(self, parent=None):
        super(LogMainWindowTruePopup, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# 自定义账户出现错误
class SetUserWindowWarningPopup(QtWidgets.QDialog, SetUserAccountWarningPopup):
    def __init__(self, parent=None):
        super(SetUserWindowWarningPopup, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# 账户创建成功提示
class SetUserWindowTruePopup(QtWidgets.QDialog, SetUserAccountTruePopup):
    def __init__(self, parent=None):
        super(SetUserWindowTruePopup, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# 账户创建主窗口
class SetUserAccountMainWindow(QtWidgets.QDialog, SetUserAccounts):
    def __init__(self, parent=None):
        super(SetUserAccountMainWindow, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.lineEdit.clear()
        self.lineEdit_2.clear()
        self.lineEdit_3.clear()
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# 游客模式窗口
class VisitorModeWindow(QtWidgets.QDialog, VisitMode):
    def __init__(self, parent=None):
        super(VisitorModeWindow, self).__init__(parent)
        self.setupUi()

    def setup(self):
        self.Dialog.setWindowFlags(Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint)  # 显示最小化、最大化以及关闭按钮
        self.Dialog.setModal(True)
        self.Dialog.show()


# 初始化各个类，将其实例化
def init_every_class():
    # 主窗口组件全局化
    global about_window, tickling_window, exit_button, visit_button, forget_password_reset
    global add_user_warning_popup, add_user_true_popup, add_users_main_window, log_in_wrong, log_in_true
    global get_information, forget_password_first, forget_password_second, forget_password_third
    global forget_password_second_true_popup, forget_password_second_warning_popup, set_account_secret_problems
    global forget_password_second_new, forget_password_first_new
    # 主界面按键实例化
    about_window = AboutWindow()  # 关于界面
    tickling_window = FeedBackWindow()  # 反馈界面
    visit_button = VisitorModeWindow()  # 游客模式
    # ”登录“按键实例化
    log_in_wrong = LogMainWindowWarningPopup()  # 账户错误
    log_in_true = LogMainWindowTruePopup()  # 账户正确
    exit_button = window  # 退出程序的按键

    # 设置账户的类实例化
    add_users_main_window = SetUserAccountMainWindow()  # 设置账户的主界面
    add_user_true_popup = SetUserWindowTruePopup()  # 设置账户的正确弹窗
    add_user_warning_popup = SetUserWindowWarningPopup()  # 错误设置的弹窗
    get_information = SecondForgetPasswordWindow()  # 设置密保问题
    set_account_secret_problems = SecondForgetPasswordWindowSecretProblems()  # 密保问题设置成功的弹窗

    # 特殊控件”忘记密码“选项实例化
    forget_password_first = FirstForgetPasswordWindow()  # ”忘记密码“的界面一（用在账密注册）
    forget_password_first_new = FirstForgetPasswordWindowNew()  # ”忘记密码“的界面一(用在重置密码)
    forget_password_second = SecondForgetPasswordWindow()  # "忘记密码"的界面二（用在账密注册）
    forget_password_second_new = SecondForgetPasswordWindowNewClass()  # ”忘记密码“的界面二（用在重置密码）
    forget_password_second_true_popup = SecondForgetPasswordWindowTruePopup()  # "忘记密码"的界面二的”正确“弹窗提示
    forget_password_second_warning_popup = SecondForgetPasswordWindowWarningPopup()  # "忘记密码"的界面二的”错误“弹窗提示
    forget_password_third = ThirdForgetPasswordWindow()  # "忘记密码"的界面三
    forget_password_reset = ForgetPasswordResetPopupWindow()  # 重置密码提示页面


# 添加槽函数以及部分功能
def add_slot_function():
    # 主界面选项卡槽函数定义
    main_win.pushButton_5.clicked["bool"].connect(about_window.setup)  # 关于界面
    about_window.pushButton.clicked["bool"].connect(about_window.Dialog.close)  # 关闭”关于“界面
    main_win.pushButton_6.clicked["bool"].connect(tickling_window.setup)  # 反馈界面
    tickling_window.pushButton.clicked["bool"].connect(tickling_window.Dialog.close)  # 关闭”反馈“界面
    main_win.pushButton_7.clicked["bool"].connect(window.exit)  # 退出按钮
    main_win.pushButton.clicked["bool"].connect(add_users_main_window.setup)  # 从主界面通过”注册“按键进入注册初始界面
    add_users_main_window.pushButton_2.clicked["bool"].connect(add_users_main_window.Dialog.close)  # 退出注册初始界面
    # ”忘记页面“和主界面的UI对话
    main_win.pushButton_2.clicked["bool"].connect(forget_password_first_new.setup)  # 进入”忘记页面“的第一个界面
    # 退出”忘记页面“的第一个界面
    forget_password_first.pushButton_2.clicked["bool"].connect(forget_password_first.Dialog.close)
    # 游客模式
    main_win.pushButton_4.clicked["bool"].connect(visit_button.setup)
    visit_button.pushButton.clicked["bool"].connect(visit_button.Dialog.close)
    # 关闭弹窗界面
    set_account_secret_problems.pushButton.clicked["bool"].connect(set_account_secret_problems.Dialog.close)
    set_account_secret_problems.pushButton.clicked["bool"].connect(get_information.Dialog.close)


# 主登录页面
def show_welcome_window():
    global window
    global main_windows
    global main_win
    main_win = BeginMainWindowGenerate()  # 实例界面对象，登录界面主窗口
    main_win.setupUi(main_windows)
    main_windows.setWindowTitle("Music Player")
    init_every_class()
    add_slot_function()
    main_windows.show()
    window.exec_()


# 程序入口
if __name__ == "__main__":
    # 调用
    show_welcome_window()
